package com.github.kezhenxu94.playground.java.miscellaneous;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.stream.IntStream;

import org.junit.Test;

public class ExploreHashMap {

	static class OddKey {
		@Override
		public int hashCode() {
			return 0;
		}

		@Override
		public boolean equals(Object obj) {
			return false;
		}
	}

	@Test
	public void testOddKey() {
		Map<OddKey, String> map = new HashMap<>();
		IntStream.range(0, 100).forEach(i -> map.put(new OddKey(), String.valueOf(i)));
		map.entrySet().forEach(System.out::println);
	}

	@Test
	public void testLinkedHashMap() {
		Map<String, String> map = new LinkedHashMap<>();
		IntStream.range(0, 100).forEach(i -> map.put(String.valueOf(100 - i), String.valueOf(i)));
		map.entrySet().forEach(System.out::println);
	}
}
